package cn.wolfcode.service.impl;


import cn.wolfcode.dao.IStudentDao;
import cn.wolfcode.dao.impl.StudentDaoimpl;
import cn.wolfcode.domain.Student;
import cn.wolfcode.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("IStudentService")
@Scope("prototype")
public class StudentServiceImpl implements IStudentService {
    @Autowired
    private IStudentDao studentDao;
    public void setStudentDao(StudentDaoimpl studentDao){
        this.studentDao = studentDao;
    }
    @Override
    public void save(String username, String password) throws Exception {
        studentDao.save(username,password);
    }
    @Override
    public void del(Long id) throws Exception {
        studentDao.delect(id);
    }

    @Override
    public void up(Long id, String username, String password) throws Exception {
        studentDao.update(id, username, password);
    }

    @Override
    public List<Student> se() throws Exception {
        List<Student> list= studentDao.select();
        return list;
    }

    @Override
    public Student seid(Long id) throws Exception {
        Student student = studentDao.selectid(id);
        return student;
    }
}
